/**
 * Copyright 2020 Inc.
 **/
package com.myz.cloud.stream.rocketmq.producer;

import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.stream.messaging.Source;
import org.springframework.messaging.support.MessageBuilder;

import javax.annotation.Resource;

/**
 * @author maoyz0621 on 2020/7/7
 * @version v1.0
 */
@SpringBootApplication
@Slf4j
public class StreamRocketMqProducerApplication implements CommandLineRunner {

    public static void main(String[] args) {
        try {
            SpringApplication.run(StreamRocketMqProducerApplication.class, args);
        } catch (Exception e) {
            log.error("start StreamRocketMqConsumerApplication error:", e);
        }
        log.info("Start StreamRocketMqConsumerApplication Success...");
    }

    @Resource
    Source source;

    @Override
    public void run(String... args) throws Exception {
        source.output().send(MessageBuilder.withPayload("hello ").build());
    }
}